#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 222;
const int F = 30;
int dp1[N][N * F];
int dp2[N][N * F];

void upd(int& a, int b) { a = max(a, b); }

int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  vector<int> d2(n);
  vector<int> d5(n);
  for (int i = 0; i < n; i++) {
    ll x;
    scanf("%lld", &x);
    for (; x % 5 == 0; x /= 5) {
      d5[i]++;
    }
    for (; x % 2 == 0; x /= 2) {
      d2[i]++;
    }
  }
  memset(dp1, -63, sizeof(dp1));
  dp1[0][0] = 0;
  for (int i = 0; i < n; i++) {
    memset(dp2, -63, sizeof(dp2));
    for (int j = 0; j <= k; j++) {
      for (int t = 0; t <= j * F; t++) {
        upd(dp2[j][t], dp1[j][t]);
        upd(dp2[j + 1][t + d5[i]], dp1[j][t] + d2[i]);
      }
    }
    memcpy(dp1, dp2, sizeof(dp2));
  }
  int answer = 0;
  for (int i = 0; i < k * F; i++) answer = max(answer, min(i, dp1[k][i]));

  cout << answer << endl;
  return 0;
}
